﻿CREATE TABLE [Lunch].[Guests] (
    [GuestId]          INT          IDENTITY (1, 1) NOT NULL,
    [AdUserId]         VARCHAR (50) NOT NULL,
    [Name]             VARCHAR (50) NOT NULL,
    [CreatedDateTime]  DATETIME     CONSTRAINT [DF_Guests_CreatedDateTime] DEFAULT (getdate()) NOT NULL,
    [CreatedUserId]    VARCHAR (50) CONSTRAINT [DF_Guests_CreatedUserId] DEFAULT (user_name()) NOT NULL,
    [ModifiedDateTime] DATETIME     CONSTRAINT [DF_Guests_ModifiedDateTime] DEFAULT (getdate()) NOT NULL,
    [ModifiedUserId]   VARCHAR (50) CONSTRAINT [DF_Guests_ModifiedUserId] DEFAULT (user_name()) NOT NULL,
    CONSTRAINT [PK_Guests] PRIMARY KEY CLUSTERED ([GuestId] ASC)
);


GO
CREATE NONCLUSTERED INDEX [IX_Guests]
    ON [Lunch].[Guests]([AdUserId] ASC);

